package routers

import (
	"github.com/gin-gonic/gin"
	swaggerFiles "github.com/swaggo/files"
	ginSwagger "github.com/swaggo/gin-swagger"
	"jy_go/app/admin/auth"
	Admin "jy_go/app/admin/controller/admin"
	Film "jy_go/app/admin/controller/film"
	Login "jy_go/app/admin/controller/login"
	Power "jy_go/app/admin/controller/power"
	Role "jy_go/app/admin/controller/role"

	_ "jy_go/docs"
)

func AdminRouter(r *gin.Engine)  {
	r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
	v1 := r.Group("/admin")
	{
		//后台登录接口
		v1.POST("/login", Login.Login)
		v1Auth := v1.Use(auth.RolePowerVerification())
		{
			//管理员接口
			v1Auth.POST("/admin_lst", Admin.Lst)
			v1Auth.POST("/admin_add", Admin.Add)
			v1Auth.POST("/admin_upd", Admin.Upd)
			v1Auth.POST("/admin_del", Admin.Del)

			//权限接口
			v1Auth.POST("/power_lst", Power.Lst)
			v1Auth.POST("/power_add", Power.Add)
			v1Auth.POST("/power_upd", Power.Upd)
			v1Auth.POST("/power_del", Power.Del)

				//角色接口
			v1Auth.POST("/role_lst", Role.Lst)
			v1Auth.POST("/role_add", Role.Add)
			v1Auth.POST("/role_upd", Role.Upd)
			v1Auth.POST("/role_del", Role.Del)

				//电影网址接口
			v1Auth.POST("/film_lst", Film.Lst)
			v1Auth.POST("/film_add", Film.Add)
			v1Auth.POST("/film_upd", Film.Upd)
			v1Auth.POST("/film_del", Film.Del)
		}
	}
}